package com.zcxx.cotton.pick.service.impl;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.text.Convert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zcxx.cotton.pick.mapper.PickInfoMapper;
import com.zcxx.cotton.pick.domain.PickInfo;
import com.zcxx.cotton.pick.service.IPickInfoService;

/**
 * 采摘信息Service业务层处理
 *
 * @author ruoyi
 * @date 2021-05-16
 */
@Service
public class PickInfoServiceImpl extends ServiceImpl<PickInfoMapper,PickInfo> implements IPickInfoService
{
    @Autowired
    private PickInfoMapper pickInfoMapper;

    /**
     * 查询采摘信息
     *
     * @param pickInfoId 采摘信息ID
     * @return 采摘信息
     */
    @Override
    public PickInfo selectPickInfoById(Long pickInfoId)
    {
        return pickInfoMapper.selectPickInfoById(pickInfoId);
    }

    /**
     * 查询采摘信息列表
     *
     * @param pickInfo 采摘信息
     * @return 采摘信息
     */
    @Override
    public List<PickInfo> selectPickInfoList(PickInfo pickInfo)
    {
        return pickInfoMapper.selectPickInfoList(pickInfo);
    }

    /**
     * 新增采摘信息
     *
     * @param pickInfo 采摘信息
     * @return 结果
     */
    @Override
    public int insertPickInfo(PickInfo pickInfo)
    {
       // pickInfo.setCreateTime(DateUtils.getNowDate());
        int result=0;
        try {
            result=pickInfoMapper.insert(pickInfo);
        }catch (Exception e){
            e.printStackTrace();
        }

        return result;
    }

    /**
     * 修改采摘信息
     *
     * @param pickInfo 采摘信息
     * @return 结果
     */
    @Override
    public int updatePickInfo(PickInfo pickInfo)
    {
       // pickInfo.setUpdateTime(DateUtils.getNowDate());
        return pickInfoMapper.updatePickInfo(pickInfo);
    }

    /**
     * 删除采摘信息对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deletePickInfoByIds(Long[] ids)
    {
        return pickInfoMapper.deletePickInfoByIds(ids);
    }

    /**
     * 删除采摘信息信息
     *
     * @param pickInfoId 采摘信息ID
     * @return 结果
     */
    @Override
    public int deletePickInfoById(Long pickInfoId)
    {
        return pickInfoMapper.deletePickInfoById(pickInfoId);
    }

    /**
     * 查询采摘信息
     *
     * @param sampleNumber 追溯码
     * @return 采摘信息
     */
    @Override
    public PickInfo selectPickInfoByCode(String sampleNumber)
    {
        return pickInfoMapper.selectPickInfoByCode(sampleNumber);
    }
    /**
     * 今日采摘统计
     *
     * @param pickInfo 采摘信息
     * @return 交售信息
     */
    @Override
    public List<Map<String,String>> getPickInfoCount(PickInfo pickInfo){
        return pickInfoMapper.getPickInfoCount(pickInfo);
    }

    /**
     * 查询采摘数量
     *
     * @param pickInfo 采摘信息
     * @return 采棉机管理集合
     */
    @Override
    public int selectPickInfoCount(PickInfo pickInfo)
    {
        return pickInfoMapper.selectPickInfoCount(pickInfo);
    }


    @Override
    public List<PickInfo> selectReportList(PickInfo pickInfo) {
        return pickInfoMapper.selectReportList(pickInfo);
    }

    @Override
    public BigDecimal selectMianbaoTotal(String category) {
        return pickInfoMapper.selectMianbaoTotal(category);
    }

    @Override
    public BigDecimal selectMianbaoToday(String category) {
        return pickInfoMapper.selectMianbaoToday(category);
    }

    @Override
    public List<PickInfo> selectTodayBao(String category) {
        return pickInfoMapper.selectTodayBao(category);
    }

    @Override
    public int updateIsSale(String isSale) {
        return pickInfoMapper.updateIsSale(isSale);
    }
}
